package com.example.musicplayer.gobang;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import androidx.annotation.NonNull;

import com.example.musicplayer.R;
import com.example.musicplayer.activity.BaseActivity;
import com.example.musicplayer.commonUtils.ToastUtil;

import java.util.HashMap;
import java.util.Set;

public class PlayingActivity extends BaseActivity implements View.OnClickListener {
    public static final String GOBANG_INTENT_ACTION = "android.intent.action.MUSIC_PLAYER_GOBANG";
    private static final int COMPUTER_END = 1;
    private HashMap<Integer, Integer> mIndexMap;
    private HashMap<Integer, Integer> mChessImage;
    private HashMap<Integer, Integer> mFocusImage;
    private HashMap<Integer, Integer> mOtherImage;
    private boolean mFirstHand = true;
    private boolean mFirstHandPreSet = true;
    private boolean mComputer = false;
    private boolean mGameEnd = false;
    private int mPromptAI = GobangAI.GRADE_3;
    private int mComputerAI = GobangAI.GRADE_1;
    private Gobang mGobang;
    private GobangAI mGobangAI;
    private MyHandler mHandler;

    @SuppressLint("HandlerLeak")
    private class MyHandler extends Handler {
        @Override
        public void handleMessage(@NonNull Message msg) {
            super.handleMessage(msg);
            if (msg.what == COMPUTER_END) {
                Location location = (Location) msg.obj;
                addChess(location);
            }
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.gobang_activity_playing);
        initHashMap();
        mGobang = new Gobang();
        mGobangAI = new GobangAI(mGobang);
        mHandler = new MyHandler();
        startGame();
    }

    private void startGame() {
        mGobang.newGame();
        mComputer = false;
        mGameEnd = false;
        mFirstHand = mFirstHandPreSet;
        clearChess();
        if (!mFirstHand) {
            mComputer = true;
            roundByComputer(false);
        }
    }

    private void addChess(Location location) {
        int x = location.getX();
        int y = location.getY();
        int round = mGobang.getRound();
        int key = findKey(x * mGobang.getChessBoardSize() + y + 1);
        if (mGobang.getChess(x, y) == Gobang.EMPTY && key != -1 && mGobang.addChess(x, y)) {
            ImageView chessImage = findViewById(mChessImage.get(key));
            if (chessImage != null) {
                if (round == Gobang.BLACK) {
                    chessImage.setImageResource(R.drawable.icon_gobang_black);
                } else {
                    chessImage.setImageResource(R.drawable.icon_gobang_white);
                }
            }
            updateFocus(x, y, true);
            if (mGobang.getCounts() >= 2) {
                updateFocus(mGobang.getLocX(mGobang.getCounts() - 2)
                        , mGobang.getLocY(mGobang.getCounts() - 2), false);
            }
            if (mGobang.win()) {
                mGameEnd = true;
                mComputer = false;
                if (round == Gobang.BLACK) {
                    ToastUtil.makeToast("黑方胜！");
                } else {
                    ToastUtil.makeToast("白方胜！");
                }
            } else {
                if ((round == Gobang.BLACK && mFirstHand) || (round == Gobang.WHITE && !mFirstHand)) {
                    mComputer = true;
                    roundByComputer(false);
                } else {
                    mComputer = false;
                }
            }
        }
    }

    private void clearChess() {
        Set<Integer> keySet = mIndexMap.keySet();
        ImageView chessImage;
        ImageView focusImage;
        for (int temp : keySet) {
            chessImage = findViewById(mChessImage.get(temp));
            if (chessImage != null) {
                chessImage.setImageBitmap(null);
            }
            focusImage = findViewById(mFocusImage.get(temp));
            if (focusImage != null) {
                focusImage.setImageBitmap(null);
            }
        }
    }

    private void updateFocus(int x, int y, boolean hasFocus) {
        int key = findKey(x * mGobang.getChessBoardSize() + y + 1);
        ImageView focusImage = findViewById(mFocusImage.get(key));
        if (hasFocus) {
            focusImage.setImageResource(R.drawable.icon_gobang_focus);
        } else {
            focusImage.setImageBitmap(null);
        }
    }

    private void regret() {
        if (mGobang.getCounts() >= 2) {
            Location location = mGobang.backChess();
            int x = location.getX();
            int y = location.getY();
            int key = findKey(x * mGobang.getChessBoardSize() + y + 1);
            ImageView chessImage = findViewById(mChessImage.get(key));
            chessImage.setImageBitmap(null);
            updateFocus(x, y, false);
            location = mGobang.backChess();
            x = location.getX();
            y = location.getY();
            key = findKey(x * mGobang.getChessBoardSize() + y + 1);
            chessImage = findViewById(mChessImage.get(key));
            chessImage.setImageBitmap(null);
            updateFocus(x, y, false);
            if (mGobang.getCounts() >= 1) {
                updateFocus(mGobang.getLocX(mGobang.getCounts() - 1)
                        , mGobang.getLocY(mGobang.getCounts() - 1), true);
            }
        }
    }

    private void roundByComputer(boolean isPrompt) {
        if (isPrompt) {
            mGobangAI.setGrade(mPromptAI);
        } else {
            mGobangAI.setGrade(mComputerAI);
        }
        new Thread() {
            @Override
            public void run() {
                Location location = mGobangAI.nextLocation();
                Message msg = mHandler.obtainMessage(COMPUTER_END);
                msg.obj = location;
                mHandler.sendMessage(msg);
            }
        }.start();
    }

    @SuppressLint("NonConstantResourceId")
    @Override
    public void onClick(View v) {
        if (v instanceof RelativeLayout && !mComputer && !mGameEnd) {
            int index = mIndexMap.get(v.getId());
            int x = (index - 1) / mGobang.getChessBoardSize();
            int y = index - x * mGobang.getChessBoardSize() - 1;
            addChess(new Location(x, y));
        } else {
            switch (v.getId()) {
                case R.id.button_reset:
                    startGame();
                    break;
                case R.id.button_ai_1:
                    mComputerAI = GobangAI.GRADE_1;
                    break;
                case R.id.button_ai_2:
                    mComputerAI = GobangAI.GRADE_2;
                    break;
                case R.id.button_ai_3:
                    mComputerAI = GobangAI.GRADE_3;
                    break;
                case R.id.button_prompt:
                    if (!mComputer && !mGameEnd) {
                        mComputer = true;
                        roundByComputer(true);
                    }
                    break;
                case R.id.button_regret:
                    if (!mComputer) {
                        regret();
                        mGameEnd = false;
                    }
                    break;
                case R.id.button_order:
                    mFirstHandPreSet = !mFirstHand;
                    if (v instanceof Button) {
                        if (mFirstHandPreSet) {
                            ((Button) v).setText(R.string.go_first_hand);
                        } else {
                            ((Button) v).setText(R.string.go_last_hand);
                        }
                    }
                    break;
                default:
                    break;
            }
        }
    }

    private int findKey(int index) {
        Set<Integer> keySet = mIndexMap.keySet();
        for (int temp : keySet) {
            if (mIndexMap.get(temp) == index) {
                return temp;
            }
        }
        return -1;
    }

    private void initHashMap() {
        mIndexMap = new HashMap<Integer, Integer>();
        mChessImage = new HashMap<Integer, Integer>();
        mFocusImage = new HashMap<Integer, Integer>();
        mOtherImage = new HashMap<Integer, Integer>();
        int key;

        key = R.id.cell_1_1;
        mIndexMap.put(key, 1);
        mChessImage.put(key, R.id.chess_1_1);
        mFocusImage.put(key, R.id.focus_1_1);
        mOtherImage.put(key, R.id.other_1_1);
        key = R.id.cell_1_2;
        mIndexMap.put(key, 2);
        mChessImage.put(key, R.id.chess_1_2);
        mFocusImage.put(key, R.id.focus_1_2);
        mOtherImage.put(key, R.id.other_1_2);
        key = R.id.cell_1_3;
        mIndexMap.put(key, 3);
        mChessImage.put(key, R.id.chess_1_3);
        mFocusImage.put(key, R.id.focus_1_3);
        mOtherImage.put(key, R.id.other_1_3);
        key = R.id.cell_1_4;
        mIndexMap.put(key, 4);
        mChessImage.put(key, R.id.chess_1_4);
        mFocusImage.put(key, R.id.focus_1_4);
        mOtherImage.put(key, R.id.other_1_4);
        key = R.id.cell_1_5;
        mIndexMap.put(key, 5);
        mChessImage.put(key, R.id.chess_1_5);
        mFocusImage.put(key, R.id.focus_1_5);
        mOtherImage.put(key, R.id.other_1_5);
        key = R.id.cell_1_6;
        mIndexMap.put(key, 6);
        mChessImage.put(key, R.id.chess_1_6);
        mFocusImage.put(key, R.id.focus_1_6);
        mOtherImage.put(key, R.id.other_1_6);
        key = R.id.cell_1_7;
        mIndexMap.put(key, 7);
        mChessImage.put(key, R.id.chess_1_7);
        mFocusImage.put(key, R.id.focus_1_7);
        mOtherImage.put(key, R.id.other_1_7);
        key = R.id.cell_1_8;
        mIndexMap.put(key, 8);
        mChessImage.put(key, R.id.chess_1_8);
        mFocusImage.put(key, R.id.focus_1_8);
        mOtherImage.put(key, R.id.other_1_8);
        key = R.id.cell_1_9;
        mIndexMap.put(key, 9);
        mChessImage.put(key, R.id.chess_1_9);
        mFocusImage.put(key, R.id.focus_1_9);
        mOtherImage.put(key, R.id.other_1_9);
        key = R.id.cell_1_10;
        mIndexMap.put(key, 10);
        mChessImage.put(key, R.id.chess_1_10);
        mFocusImage.put(key, R.id.focus_1_10);
        mOtherImage.put(key, R.id.other_1_10);
        key = R.id.cell_1_11;
        mIndexMap.put(key, 11);
        mChessImage.put(key, R.id.chess_1_11);
        mFocusImage.put(key, R.id.focus_1_11);
        mOtherImage.put(key, R.id.other_1_11);
        key = R.id.cell_1_12;
        mIndexMap.put(key, 12);
        mChessImage.put(key, R.id.chess_1_12);
        mFocusImage.put(key, R.id.focus_1_12);
        mOtherImage.put(key, R.id.other_1_12);
        key = R.id.cell_1_13;
        mIndexMap.put(key, 13);
        mChessImage.put(key, R.id.chess_1_13);
        mFocusImage.put(key, R.id.focus_1_13);
        mOtherImage.put(key, R.id.other_1_13);
        key = R.id.cell_1_14;
        mIndexMap.put(key, 14);
        mChessImage.put(key, R.id.chess_1_14);
        mFocusImage.put(key, R.id.focus_1_14);
        mOtherImage.put(key, R.id.other_1_14);
        key = R.id.cell_1_15;
        mIndexMap.put(key, 15);
        mChessImage.put(key, R.id.chess_1_15);
        mFocusImage.put(key, R.id.focus_1_15);
        mOtherImage.put(key, R.id.other_1_15);

        key = R.id.cell_2_1;
        mIndexMap.put(key, 16);
        mChessImage.put(key, R.id.chess_2_1);
        mFocusImage.put(key, R.id.focus_2_1);
        mOtherImage.put(key, R.id.other_2_1);
        key = R.id.cell_2_2;
        mIndexMap.put(key, 17);
        mChessImage.put(key, R.id.chess_2_2);
        mFocusImage.put(key, R.id.focus_2_2);
        mOtherImage.put(key, R.id.other_2_2);
        key = R.id.cell_2_3;
        mIndexMap.put(key, 18);
        mChessImage.put(key, R.id.chess_2_3);
        mFocusImage.put(key, R.id.focus_2_3);
        mOtherImage.put(key, R.id.other_2_3);
        key = R.id.cell_2_4;
        mIndexMap.put(key, 19);
        mChessImage.put(key, R.id.chess_2_4);
        mFocusImage.put(key, R.id.focus_2_4);
        mOtherImage.put(key, R.id.other_2_4);
        key = R.id.cell_2_5;
        mIndexMap.put(key, 20);
        mChessImage.put(key, R.id.chess_2_5);
        mFocusImage.put(key, R.id.focus_2_5);
        mOtherImage.put(key, R.id.other_2_5);
        key = R.id.cell_2_6;
        mIndexMap.put(key, 21);
        mChessImage.put(key, R.id.chess_2_6);
        mFocusImage.put(key, R.id.focus_2_6);
        mOtherImage.put(key, R.id.other_2_6);
        key = R.id.cell_2_7;
        mIndexMap.put(key, 22);
        mChessImage.put(key, R.id.chess_2_7);
        mFocusImage.put(key, R.id.focus_2_7);
        mOtherImage.put(key, R.id.other_2_7);
        key = R.id.cell_2_8;
        mIndexMap.put(key, 23);
        mChessImage.put(key, R.id.chess_2_8);
        mFocusImage.put(key, R.id.focus_2_8);
        mOtherImage.put(key, R.id.other_2_8);
        key = R.id.cell_2_9;
        mIndexMap.put(key, 24);
        mChessImage.put(key, R.id.chess_2_9);
        mFocusImage.put(key, R.id.focus_2_9);
        mOtherImage.put(key, R.id.other_2_9);
        key = R.id.cell_2_10;
        mIndexMap.put(key, 25);
        mChessImage.put(key, R.id.chess_2_10);
        mFocusImage.put(key, R.id.focus_2_10);
        mOtherImage.put(key, R.id.other_2_10);
        key = R.id.cell_2_11;
        mIndexMap.put(key, 26);
        mChessImage.put(key, R.id.chess_2_11);
        mFocusImage.put(key, R.id.focus_2_11);
        mOtherImage.put(key, R.id.other_2_11);
        key = R.id.cell_2_12;
        mIndexMap.put(key, 27);
        mChessImage.put(key, R.id.chess_2_12);
        mFocusImage.put(key, R.id.focus_2_12);
        mOtherImage.put(key, R.id.other_2_12);
        key = R.id.cell_2_13;
        mIndexMap.put(key, 28);
        mChessImage.put(key, R.id.chess_2_13);
        mFocusImage.put(key, R.id.focus_2_13);
        mOtherImage.put(key, R.id.other_2_13);
        key = R.id.cell_2_14;
        mIndexMap.put(key, 29);
        mChessImage.put(key, R.id.chess_2_14);
        mFocusImage.put(key, R.id.focus_2_14);
        mOtherImage.put(key, R.id.other_2_14);
        key = R.id.cell_2_15;
        mIndexMap.put(key, 30);
        mChessImage.put(key, R.id.chess_2_15);
        mFocusImage.put(key, R.id.focus_2_15);
        mOtherImage.put(key, R.id.other_2_15);

        key = R.id.cell_3_1;
        mIndexMap.put(key, 31);
        mChessImage.put(key, R.id.chess_3_1);
        mFocusImage.put(key, R.id.focus_3_1);
        mOtherImage.put(key, R.id.other_3_1);
        key = R.id.cell_3_2;
        mIndexMap.put(key, 32);
        mChessImage.put(key, R.id.chess_3_2);
        mFocusImage.put(key, R.id.focus_3_2);
        mOtherImage.put(key, R.id.other_3_2);
        key = R.id.cell_3_3;
        mIndexMap.put(key, 33);
        mChessImage.put(key, R.id.chess_3_3);
        mFocusImage.put(key, R.id.focus_3_3);
        mOtherImage.put(key, R.id.other_3_3);
        key = R.id.cell_3_4;
        mIndexMap.put(key, 34);
        mChessImage.put(key, R.id.chess_3_4);
        mFocusImage.put(key, R.id.focus_3_4);
        mOtherImage.put(key, R.id.other_3_4);
        key = R.id.cell_3_5;
        mIndexMap.put(key, 35);
        mChessImage.put(key, R.id.chess_3_5);
        mFocusImage.put(key, R.id.focus_3_5);
        mOtherImage.put(key, R.id.other_3_5);
        key = R.id.cell_3_6;
        mIndexMap.put(key, 36);
        mChessImage.put(key, R.id.chess_3_6);
        mFocusImage.put(key, R.id.focus_3_6);
        mOtherImage.put(key, R.id.other_3_6);
        key = R.id.cell_3_7;
        mIndexMap.put(key, 37);
        mChessImage.put(key, R.id.chess_3_7);
        mFocusImage.put(key, R.id.focus_3_7);
        mOtherImage.put(key, R.id.other_3_7);
        key = R.id.cell_3_8;
        mIndexMap.put(key, 38);
        mChessImage.put(key, R.id.chess_3_8);
        mFocusImage.put(key, R.id.focus_3_8);
        mOtherImage.put(key, R.id.other_3_8);
        key = R.id.cell_3_9;
        mIndexMap.put(key, 39);
        mChessImage.put(key, R.id.chess_3_9);
        mFocusImage.put(key, R.id.focus_3_9);
        mOtherImage.put(key, R.id.other_3_9);
        key = R.id.cell_3_10;
        mIndexMap.put(key, 40);
        mChessImage.put(key, R.id.chess_3_10);
        mFocusImage.put(key, R.id.focus_3_10);
        mOtherImage.put(key, R.id.other_3_10);
        key = R.id.cell_3_11;
        mIndexMap.put(key, 41);
        mChessImage.put(key, R.id.chess_3_11);
        mFocusImage.put(key, R.id.focus_3_11);
        mOtherImage.put(key, R.id.other_3_11);
        key = R.id.cell_3_12;
        mIndexMap.put(key, 42);
        mChessImage.put(key, R.id.chess_3_12);
        mFocusImage.put(key, R.id.focus_3_12);
        mOtherImage.put(key, R.id.other_3_12);
        key = R.id.cell_3_13;
        mIndexMap.put(key, 43);
        mChessImage.put(key, R.id.chess_3_13);
        mFocusImage.put(key, R.id.focus_3_13);
        mOtherImage.put(key, R.id.other_3_13);
        key = R.id.cell_3_14;
        mIndexMap.put(key, 44);
        mChessImage.put(key, R.id.chess_3_14);
        mFocusImage.put(key, R.id.focus_3_14);
        mOtherImage.put(key, R.id.other_3_14);
        key = R.id.cell_3_15;
        mIndexMap.put(key, 45);
        mChessImage.put(key, R.id.chess_3_15);
        mFocusImage.put(key, R.id.focus_3_15);
        mOtherImage.put(key, R.id.other_3_15);

        key = R.id.cell_4_1;
        mIndexMap.put(key, 46);
        mChessImage.put(key, R.id.chess_4_1);
        mFocusImage.put(key, R.id.focus_4_1);
        mOtherImage.put(key, R.id.other_4_1);
        key = R.id.cell_4_2;
        mIndexMap.put(key, 47);
        mChessImage.put(key, R.id.chess_4_2);
        mFocusImage.put(key, R.id.focus_4_2);
        mOtherImage.put(key, R.id.other_4_2);
        key = R.id.cell_4_3;
        mIndexMap.put(key, 48);
        mChessImage.put(key, R.id.chess_4_3);
        mFocusImage.put(key, R.id.focus_4_3);
        mOtherImage.put(key, R.id.other_4_3);
        key = R.id.cell_4_4;
        mIndexMap.put(key, 49);
        mChessImage.put(key, R.id.chess_4_4);
        mFocusImage.put(key, R.id.focus_4_4);
        mOtherImage.put(key, R.id.other_4_4);
        key = R.id.cell_4_5;
        mIndexMap.put(key, 50);
        mChessImage.put(key, R.id.chess_4_5);
        mFocusImage.put(key, R.id.focus_4_5);
        mOtherImage.put(key, R.id.other_4_5);
        key = R.id.cell_4_6;
        mIndexMap.put(key, 51);
        mChessImage.put(key, R.id.chess_4_6);
        mFocusImage.put(key, R.id.focus_4_6);
        mOtherImage.put(key, R.id.other_4_6);
        key = R.id.cell_4_7;
        mIndexMap.put(key, 52);
        mChessImage.put(key, R.id.chess_4_7);
        mFocusImage.put(key, R.id.focus_4_7);
        mOtherImage.put(key, R.id.other_4_7);
        key = R.id.cell_4_8;
        mIndexMap.put(key, 53);
        mChessImage.put(key, R.id.chess_4_8);
        mFocusImage.put(key, R.id.focus_4_8);
        mOtherImage.put(key, R.id.other_4_8);
        key = R.id.cell_4_9;
        mIndexMap.put(key, 54);
        mChessImage.put(key, R.id.chess_4_9);
        mFocusImage.put(key, R.id.focus_4_9);
        mOtherImage.put(key, R.id.other_4_9);
        key = R.id.cell_4_10;
        mIndexMap.put(key, 55);
        mChessImage.put(key, R.id.chess_4_10);
        mFocusImage.put(key, R.id.focus_4_10);
        mOtherImage.put(key, R.id.other_4_10);
        key = R.id.cell_4_11;
        mIndexMap.put(key, 56);
        mChessImage.put(key, R.id.chess_4_11);
        mFocusImage.put(key, R.id.focus_4_11);
        mOtherImage.put(key, R.id.other_4_11);
        key = R.id.cell_4_12;
        mIndexMap.put(key, 57);
        mChessImage.put(key, R.id.chess_4_12);
        mFocusImage.put(key, R.id.focus_4_12);
        mOtherImage.put(key, R.id.other_4_12);
        key = R.id.cell_4_13;
        mIndexMap.put(key, 58);
        mChessImage.put(key, R.id.chess_4_13);
        mFocusImage.put(key, R.id.focus_4_13);
        mOtherImage.put(key, R.id.other_4_13);
        key = R.id.cell_4_14;
        mIndexMap.put(key, 59);
        mChessImage.put(key, R.id.chess_4_14);
        mFocusImage.put(key, R.id.focus_4_14);
        mOtherImage.put(key, R.id.other_4_14);
        key = R.id.cell_4_15;
        mIndexMap.put(key, 60);
        mChessImage.put(key, R.id.chess_4_15);
        mFocusImage.put(key, R.id.focus_4_15);
        mOtherImage.put(key, R.id.other_4_15);

        key = R.id.cell_5_1;
        mIndexMap.put(key, 61);
        mChessImage.put(key, R.id.chess_5_1);
        mFocusImage.put(key, R.id.focus_5_1);
        mOtherImage.put(key, R.id.other_5_1);
        key = R.id.cell_5_2;
        mIndexMap.put(key, 62);
        mChessImage.put(key, R.id.chess_5_2);
        mFocusImage.put(key, R.id.focus_5_2);
        mOtherImage.put(key, R.id.other_5_2);
        key = R.id.cell_5_3;
        mIndexMap.put(key, 63);
        mChessImage.put(key, R.id.chess_5_3);
        mFocusImage.put(key, R.id.focus_5_3);
        mOtherImage.put(key, R.id.other_5_3);
        key = R.id.cell_5_4;
        mIndexMap.put(key, 64);
        mChessImage.put(key, R.id.chess_5_4);
        mFocusImage.put(key, R.id.focus_5_4);
        mOtherImage.put(key, R.id.other_5_4);
        key = R.id.cell_5_5;
        mIndexMap.put(key, 65);
        mChessImage.put(key, R.id.chess_5_5);
        mFocusImage.put(key, R.id.focus_5_5);
        mOtherImage.put(key, R.id.other_5_5);
        key = R.id.cell_5_6;
        mIndexMap.put(key, 66);
        mChessImage.put(key, R.id.chess_5_6);
        mFocusImage.put(key, R.id.focus_5_6);
        mOtherImage.put(key, R.id.other_5_6);
        key = R.id.cell_5_7;
        mIndexMap.put(key, 67);
        mChessImage.put(key, R.id.chess_5_7);
        mFocusImage.put(key, R.id.focus_5_7);
        mOtherImage.put(key, R.id.other_5_7);
        key = R.id.cell_5_8;
        mIndexMap.put(key, 68);
        mChessImage.put(key, R.id.chess_5_8);
        mFocusImage.put(key, R.id.focus_5_8);
        mOtherImage.put(key, R.id.other_5_8);
        key = R.id.cell_5_9;
        mIndexMap.put(key, 69);
        mChessImage.put(key, R.id.chess_5_9);
        mFocusImage.put(key, R.id.focus_5_9);
        mOtherImage.put(key, R.id.other_5_9);
        key = R.id.cell_5_10;
        mIndexMap.put(key, 70);
        mChessImage.put(key, R.id.chess_5_10);
        mFocusImage.put(key, R.id.focus_5_10);
        mOtherImage.put(key, R.id.other_5_10);
        key = R.id.cell_5_11;
        mIndexMap.put(key, 71);
        mChessImage.put(key, R.id.chess_5_11);
        mFocusImage.put(key, R.id.focus_5_11);
        mOtherImage.put(key, R.id.other_5_11);
        key = R.id.cell_5_12;
        mIndexMap.put(key, 72);
        mChessImage.put(key, R.id.chess_5_12);
        mFocusImage.put(key, R.id.focus_5_12);
        mOtherImage.put(key, R.id.other_5_12);
        key = R.id.cell_5_13;
        mIndexMap.put(key, 73);
        mChessImage.put(key, R.id.chess_5_13);
        mFocusImage.put(key, R.id.focus_5_13);
        mOtherImage.put(key, R.id.other_5_13);
        key = R.id.cell_5_14;
        mIndexMap.put(key, 74);
        mChessImage.put(key, R.id.chess_5_14);
        mFocusImage.put(key, R.id.focus_5_14);
        mOtherImage.put(key, R.id.other_5_14);
        key = R.id.cell_5_15;
        mIndexMap.put(key, 75);
        mChessImage.put(key, R.id.chess_5_15);
        mFocusImage.put(key, R.id.focus_5_15);
        mOtherImage.put(key, R.id.other_5_15);

        key = R.id.cell_6_1;
        mIndexMap.put(key, 76);
        mChessImage.put(key, R.id.chess_6_1);
        mFocusImage.put(key, R.id.focus_6_1);
        mOtherImage.put(key, R.id.other_6_1);
        key = R.id.cell_6_2;
        mIndexMap.put(key, 77);
        mChessImage.put(key, R.id.chess_6_2);
        mFocusImage.put(key, R.id.focus_6_2);
        mOtherImage.put(key, R.id.other_6_2);
        key = R.id.cell_6_3;
        mIndexMap.put(key, 78);
        mChessImage.put(key, R.id.chess_6_3);
        mFocusImage.put(key, R.id.focus_6_3);
        mOtherImage.put(key, R.id.other_6_3);
        key = R.id.cell_6_4;
        mIndexMap.put(key, 79);
        mChessImage.put(key, R.id.chess_6_4);
        mFocusImage.put(key, R.id.focus_6_4);
        mOtherImage.put(key, R.id.other_6_4);
        key = R.id.cell_6_5;
        mIndexMap.put(key, 80);
        mChessImage.put(key, R.id.chess_6_5);
        mFocusImage.put(key, R.id.focus_6_5);
        mOtherImage.put(key, R.id.other_6_5);
        key = R.id.cell_6_6;
        mIndexMap.put(key, 81);
        mChessImage.put(key, R.id.chess_6_6);
        mFocusImage.put(key, R.id.focus_6_6);
        mOtherImage.put(key, R.id.other_6_6);
        key = R.id.cell_6_7;
        mIndexMap.put(key, 82);
        mChessImage.put(key, R.id.chess_6_7);
        mFocusImage.put(key, R.id.focus_6_7);
        mOtherImage.put(key, R.id.other_6_7);
        key = R.id.cell_6_8;
        mIndexMap.put(key, 83);
        mChessImage.put(key, R.id.chess_6_8);
        mFocusImage.put(key, R.id.focus_6_8);
        mOtherImage.put(key, R.id.other_6_8);
        key = R.id.cell_6_9;
        mIndexMap.put(key, 84);
        mChessImage.put(key, R.id.chess_6_9);
        mFocusImage.put(key, R.id.focus_6_9);
        mOtherImage.put(key, R.id.other_6_9);
        key = R.id.cell_6_10;
        mIndexMap.put(key, 85);
        mChessImage.put(key, R.id.chess_6_10);
        mFocusImage.put(key, R.id.focus_6_10);
        mOtherImage.put(key, R.id.other_6_10);
        key = R.id.cell_6_11;
        mIndexMap.put(key, 86);
        mChessImage.put(key, R.id.chess_6_11);
        mFocusImage.put(key, R.id.focus_6_11);
        mOtherImage.put(key, R.id.other_6_11);
        key = R.id.cell_6_12;
        mIndexMap.put(key, 87);
        mChessImage.put(key, R.id.chess_6_12);
        mFocusImage.put(key, R.id.focus_6_12);
        mOtherImage.put(key, R.id.other_6_12);
        key = R.id.cell_6_13;
        mIndexMap.put(key, 88);
        mChessImage.put(key, R.id.chess_6_13);
        mFocusImage.put(key, R.id.focus_6_13);
        mOtherImage.put(key, R.id.other_6_13);
        key = R.id.cell_6_14;
        mIndexMap.put(key, 89);
        mChessImage.put(key, R.id.chess_6_14);
        mFocusImage.put(key, R.id.focus_6_14);
        mOtherImage.put(key, R.id.other_6_14);
        key = R.id.cell_6_15;
        mIndexMap.put(key, 90);
        mChessImage.put(key, R.id.chess_6_15);
        mFocusImage.put(key, R.id.focus_6_15);
        mOtherImage.put(key, R.id.other_6_15);

        key = R.id.cell_7_1;
        mIndexMap.put(key, 91);
        mChessImage.put(key, R.id.chess_7_1);
        mFocusImage.put(key, R.id.focus_7_1);
        mOtherImage.put(key, R.id.other_7_1);
        key = R.id.cell_7_2;
        mIndexMap.put(key, 92);
        mChessImage.put(key, R.id.chess_7_2);
        mFocusImage.put(key, R.id.focus_7_2);
        mOtherImage.put(key, R.id.other_7_2);
        key = R.id.cell_7_3;
        mIndexMap.put(key, 93);
        mChessImage.put(key, R.id.chess_7_3);
        mFocusImage.put(key, R.id.focus_7_3);
        mOtherImage.put(key, R.id.other_7_3);
        key = R.id.cell_7_4;
        mIndexMap.put(key, 94);
        mChessImage.put(key, R.id.chess_7_4);
        mFocusImage.put(key, R.id.focus_7_4);
        mOtherImage.put(key, R.id.other_7_4);
        key = R.id.cell_7_5;
        mIndexMap.put(key, 95);
        mChessImage.put(key, R.id.chess_7_5);
        mFocusImage.put(key, R.id.focus_7_5);
        mOtherImage.put(key, R.id.other_7_5);
        key = R.id.cell_7_6;
        mIndexMap.put(key, 96);
        mChessImage.put(key, R.id.chess_7_6);
        mFocusImage.put(key, R.id.focus_7_6);
        mOtherImage.put(key, R.id.other_7_6);
        key = R.id.cell_7_7;
        mIndexMap.put(key, 97);
        mChessImage.put(key, R.id.chess_7_7);
        mFocusImage.put(key, R.id.focus_7_7);
        mOtherImage.put(key, R.id.other_7_7);
        key = R.id.cell_7_8;
        mIndexMap.put(key, 98);
        mChessImage.put(key, R.id.chess_7_8);
        mFocusImage.put(key, R.id.focus_7_8);
        mOtherImage.put(key, R.id.other_7_8);
        key = R.id.cell_7_9;
        mIndexMap.put(key, 99);
        mChessImage.put(key, R.id.chess_7_9);
        mFocusImage.put(key, R.id.focus_7_9);
        mOtherImage.put(key, R.id.other_7_9);
        key = R.id.cell_7_10;
        mIndexMap.put(key, 100);
        mChessImage.put(key, R.id.chess_7_10);
        mFocusImage.put(key, R.id.focus_7_10);
        mOtherImage.put(key, R.id.other_7_10);
        key = R.id.cell_7_11;
        mIndexMap.put(key, 101);
        mChessImage.put(key, R.id.chess_7_11);
        mFocusImage.put(key, R.id.focus_7_11);
        mOtherImage.put(key, R.id.other_7_11);
        key = R.id.cell_7_12;
        mIndexMap.put(key, 102);
        mChessImage.put(key, R.id.chess_7_12);
        mFocusImage.put(key, R.id.focus_7_12);
        mOtherImage.put(key, R.id.other_7_12);
        key = R.id.cell_7_13;
        mIndexMap.put(key, 103);
        mChessImage.put(key, R.id.chess_7_13);
        mFocusImage.put(key, R.id.focus_7_13);
        mOtherImage.put(key, R.id.other_7_13);
        key = R.id.cell_7_14;
        mIndexMap.put(key, 104);
        mChessImage.put(key, R.id.chess_7_14);
        mFocusImage.put(key, R.id.focus_7_14);
        mOtherImage.put(key, R.id.other_7_14);
        key = R.id.cell_7_15;
        mIndexMap.put(key, 105);
        mChessImage.put(key, R.id.chess_7_15);
        mFocusImage.put(key, R.id.focus_7_15);
        mOtherImage.put(key, R.id.other_7_15);

        key = R.id.cell_8_1;
        mIndexMap.put(key, 106);
        mChessImage.put(key, R.id.chess_8_1);
        mFocusImage.put(key, R.id.focus_8_1);
        mOtherImage.put(key, R.id.other_8_1);
        key = R.id.cell_8_2;
        mIndexMap.put(key, 107);
        mChessImage.put(key, R.id.chess_8_2);
        mFocusImage.put(key, R.id.focus_8_2);
        mOtherImage.put(key, R.id.other_8_2);
        key = R.id.cell_8_3;
        mIndexMap.put(key, 108);
        mChessImage.put(key, R.id.chess_8_3);
        mFocusImage.put(key, R.id.focus_8_3);
        mOtherImage.put(key, R.id.other_8_3);
        key = R.id.cell_8_4;
        mIndexMap.put(key, 109);
        mChessImage.put(key, R.id.chess_8_4);
        mFocusImage.put(key, R.id.focus_8_4);
        mOtherImage.put(key, R.id.other_8_4);
        key = R.id.cell_8_5;
        mIndexMap.put(key, 110);
        mChessImage.put(key, R.id.chess_8_5);
        mFocusImage.put(key, R.id.focus_8_5);
        mOtherImage.put(key, R.id.other_8_5);
        key = R.id.cell_8_6;
        mIndexMap.put(key, 111);
        mChessImage.put(key, R.id.chess_8_6);
        mFocusImage.put(key, R.id.focus_8_6);
        mOtherImage.put(key, R.id.other_8_6);
        key = R.id.cell_8_7;
        mIndexMap.put(key, 112);
        mChessImage.put(key, R.id.chess_8_7);
        mFocusImage.put(key, R.id.focus_8_7);
        mOtherImage.put(key, R.id.other_8_7);
        key = R.id.cell_8_8;
        mIndexMap.put(key, 113);
        mChessImage.put(key, R.id.chess_8_8);
        mFocusImage.put(key, R.id.focus_8_8);
        mOtherImage.put(key, R.id.other_8_8);
        key = R.id.cell_8_9;
        mIndexMap.put(key, 114);
        mChessImage.put(key, R.id.chess_8_9);
        mFocusImage.put(key, R.id.focus_8_9);
        mOtherImage.put(key, R.id.other_8_9);
        key = R.id.cell_8_10;
        mIndexMap.put(key, 115);
        mChessImage.put(key, R.id.chess_8_10);
        mFocusImage.put(key, R.id.focus_8_10);
        mOtherImage.put(key, R.id.other_8_10);
        key = R.id.cell_8_11;
        mIndexMap.put(key, 116);
        mChessImage.put(key, R.id.chess_8_11);
        mFocusImage.put(key, R.id.focus_8_11);
        mOtherImage.put(key, R.id.other_8_11);
        key = R.id.cell_8_12;
        mIndexMap.put(key, 117);
        mChessImage.put(key, R.id.chess_8_12);
        mFocusImage.put(key, R.id.focus_8_12);
        mOtherImage.put(key, R.id.other_8_12);
        key = R.id.cell_8_13;
        mIndexMap.put(key, 118);
        mChessImage.put(key, R.id.chess_8_13);
        mFocusImage.put(key, R.id.focus_8_13);
        mOtherImage.put(key, R.id.other_8_13);
        key = R.id.cell_8_14;
        mIndexMap.put(key, 119);
        mChessImage.put(key, R.id.chess_8_14);
        mFocusImage.put(key, R.id.focus_8_14);
        mOtherImage.put(key, R.id.other_8_14);
        key = R.id.cell_8_15;
        mIndexMap.put(key, 120);
        mChessImage.put(key, R.id.chess_8_15);
        mFocusImage.put(key, R.id.focus_8_15);
        mOtherImage.put(key, R.id.other_8_15);

        key = R.id.cell_9_1;
        mIndexMap.put(key, 121);
        mChessImage.put(key, R.id.chess_9_1);
        mFocusImage.put(key, R.id.focus_9_1);
        mOtherImage.put(key, R.id.other_9_1);
        key = R.id.cell_9_2;
        mIndexMap.put(key, 122);
        mChessImage.put(key, R.id.chess_9_2);
        mFocusImage.put(key, R.id.focus_9_2);
        mOtherImage.put(key, R.id.other_9_2);
        key = R.id.cell_9_3;
        mIndexMap.put(key, 123);
        mChessImage.put(key, R.id.chess_9_3);
        mFocusImage.put(key, R.id.focus_9_3);
        mOtherImage.put(key, R.id.other_9_3);
        key = R.id.cell_9_4;
        mIndexMap.put(key, 124);
        mChessImage.put(key, R.id.chess_9_4);
        mFocusImage.put(key, R.id.focus_9_4);
        mOtherImage.put(key, R.id.other_9_4);
        key = R.id.cell_9_5;
        mIndexMap.put(key, 125);
        mChessImage.put(key, R.id.chess_9_5);
        mFocusImage.put(key, R.id.focus_9_5);
        mOtherImage.put(key, R.id.other_9_5);
        key = R.id.cell_9_6;
        mIndexMap.put(key, 126);
        mChessImage.put(key, R.id.chess_9_6);
        mFocusImage.put(key, R.id.focus_9_6);
        mOtherImage.put(key, R.id.other_9_6);
        key = R.id.cell_9_7;
        mIndexMap.put(key, 127);
        mChessImage.put(key, R.id.chess_9_7);
        mFocusImage.put(key, R.id.focus_9_7);
        mOtherImage.put(key, R.id.other_9_7);
        key = R.id.cell_9_8;
        mIndexMap.put(key, 128);
        mChessImage.put(key, R.id.chess_9_8);
        mFocusImage.put(key, R.id.focus_9_8);
        mOtherImage.put(key, R.id.other_9_8);
        key = R.id.cell_9_9;
        mIndexMap.put(key, 129);
        mChessImage.put(key, R.id.chess_9_9);
        mFocusImage.put(key, R.id.focus_9_9);
        mOtherImage.put(key, R.id.other_9_9);
        key = R.id.cell_9_10;
        mIndexMap.put(key, 130);
        mChessImage.put(key, R.id.chess_9_10);
        mFocusImage.put(key, R.id.focus_9_10);
        mOtherImage.put(key, R.id.other_9_10);
        key = R.id.cell_9_11;
        mIndexMap.put(key, 131);
        mChessImage.put(key, R.id.chess_9_11);
        mFocusImage.put(key, R.id.focus_9_11);
        mOtherImage.put(key, R.id.other_9_11);
        key = R.id.cell_9_12;
        mIndexMap.put(key, 132);
        mChessImage.put(key, R.id.chess_9_12);
        mFocusImage.put(key, R.id.focus_9_12);
        mOtherImage.put(key, R.id.other_9_12);
        key = R.id.cell_9_13;
        mIndexMap.put(key, 133);
        mChessImage.put(key, R.id.chess_9_13);
        mFocusImage.put(key, R.id.focus_9_13);
        mOtherImage.put(key, R.id.other_9_13);
        key = R.id.cell_9_14;
        mIndexMap.put(key, 134);
        mChessImage.put(key, R.id.chess_9_14);
        mFocusImage.put(key, R.id.focus_9_14);
        mOtherImage.put(key, R.id.other_9_14);
        key = R.id.cell_9_15;
        mIndexMap.put(key, 135);
        mChessImage.put(key, R.id.chess_9_15);
        mFocusImage.put(key, R.id.focus_9_15);
        mOtherImage.put(key, R.id.other_9_15);

        key = R.id.cell_10_1;
        mIndexMap.put(key, 136);
        mChessImage.put(key, R.id.chess_10_1);
        mFocusImage.put(key, R.id.focus_10_1);
        mOtherImage.put(key, R.id.other_10_1);
        key = R.id.cell_10_2;
        mIndexMap.put(key, 137);
        mChessImage.put(key, R.id.chess_10_2);
        mFocusImage.put(key, R.id.focus_10_2);
        mOtherImage.put(key, R.id.other_10_2);
        key = R.id.cell_10_3;
        mIndexMap.put(key, 138);
        mChessImage.put(key, R.id.chess_10_3);
        mFocusImage.put(key, R.id.focus_10_3);
        mOtherImage.put(key, R.id.other_10_3);
        key = R.id.cell_10_4;
        mIndexMap.put(key, 139);
        mChessImage.put(key, R.id.chess_10_4);
        mFocusImage.put(key, R.id.focus_10_4);
        mOtherImage.put(key, R.id.other_10_4);
        key = R.id.cell_10_5;
        mIndexMap.put(key, 140);
        mChessImage.put(key, R.id.chess_10_5);
        mFocusImage.put(key, R.id.focus_10_5);
        mOtherImage.put(key, R.id.other_10_5);
        key = R.id.cell_10_6;
        mIndexMap.put(key, 141);
        mChessImage.put(key, R.id.chess_10_6);
        mFocusImage.put(key, R.id.focus_10_6);
        mOtherImage.put(key, R.id.other_10_6);
        key = R.id.cell_10_7;
        mIndexMap.put(key, 142);
        mChessImage.put(key, R.id.chess_10_7);
        mFocusImage.put(key, R.id.focus_10_7);
        mOtherImage.put(key, R.id.other_10_7);
        key = R.id.cell_10_8;
        mIndexMap.put(key, 143);
        mChessImage.put(key, R.id.chess_10_8);
        mFocusImage.put(key, R.id.focus_10_8);
        mOtherImage.put(key, R.id.other_10_8);
        key = R.id.cell_10_9;
        mIndexMap.put(key, 144);
        mChessImage.put(key, R.id.chess_10_9);
        mFocusImage.put(key, R.id.focus_10_9);
        mOtherImage.put(key, R.id.other_10_9);
        key = R.id.cell_10_10;
        mIndexMap.put(key, 145);
        mChessImage.put(key, R.id.chess_10_10);
        mFocusImage.put(key, R.id.focus_10_10);
        mOtherImage.put(key, R.id.other_10_10);
        key = R.id.cell_10_11;
        mIndexMap.put(key, 146);
        mChessImage.put(key, R.id.chess_10_11);
        mFocusImage.put(key, R.id.focus_10_11);
        mOtherImage.put(key, R.id.other_10_11);
        key = R.id.cell_10_12;
        mIndexMap.put(key, 147);
        mChessImage.put(key, R.id.chess_10_12);
        mFocusImage.put(key, R.id.focus_10_12);
        mOtherImage.put(key, R.id.other_10_12);
        key = R.id.cell_10_13;
        mIndexMap.put(key, 148);
        mChessImage.put(key, R.id.chess_10_13);
        mFocusImage.put(key, R.id.focus_10_13);
        mOtherImage.put(key, R.id.other_10_13);
        key = R.id.cell_10_14;
        mIndexMap.put(key, 149);
        mChessImage.put(key, R.id.chess_10_14);
        mFocusImage.put(key, R.id.focus_10_14);
        mOtherImage.put(key, R.id.other_10_14);
        key = R.id.cell_10_15;
        mIndexMap.put(key, 150);
        mChessImage.put(key, R.id.chess_10_15);
        mFocusImage.put(key, R.id.focus_10_15);
        mOtherImage.put(key, R.id.other_10_15);

        key = R.id.cell_11_1;
        mIndexMap.put(key, 151);
        mChessImage.put(key, R.id.chess_11_1);
        mFocusImage.put(key, R.id.focus_11_1);
        mOtherImage.put(key, R.id.other_11_1);
        key = R.id.cell_11_2;
        mIndexMap.put(key, 152);
        mChessImage.put(key, R.id.chess_11_2);
        mFocusImage.put(key, R.id.focus_11_2);
        mOtherImage.put(key, R.id.other_11_2);
        key = R.id.cell_11_3;
        mIndexMap.put(key, 153);
        mChessImage.put(key, R.id.chess_11_3);
        mFocusImage.put(key, R.id.focus_11_3);
        mOtherImage.put(key, R.id.other_11_3);
        key = R.id.cell_11_4;
        mIndexMap.put(key, 154);
        mChessImage.put(key, R.id.chess_11_4);
        mFocusImage.put(key, R.id.focus_11_4);
        mOtherImage.put(key, R.id.other_11_4);
        key = R.id.cell_11_5;
        mIndexMap.put(key, 155);
        mChessImage.put(key, R.id.chess_11_5);
        mFocusImage.put(key, R.id.focus_11_5);
        mOtherImage.put(key, R.id.other_11_5);
        key = R.id.cell_11_6;
        mIndexMap.put(key, 156);
        mChessImage.put(key, R.id.chess_11_6);
        mFocusImage.put(key, R.id.focus_11_6);
        mOtherImage.put(key, R.id.other_11_6);
        key = R.id.cell_11_7;
        mIndexMap.put(key, 157);
        mChessImage.put(key, R.id.chess_11_7);
        mFocusImage.put(key, R.id.focus_11_7);
        mOtherImage.put(key, R.id.other_11_7);
        key = R.id.cell_11_8;
        mIndexMap.put(key, 158);
        mChessImage.put(key, R.id.chess_11_8);
        mFocusImage.put(key, R.id.focus_11_8);
        mOtherImage.put(key, R.id.other_11_8);
        key = R.id.cell_11_9;
        mIndexMap.put(key, 159);
        mChessImage.put(key, R.id.chess_11_9);
        mFocusImage.put(key, R.id.focus_11_9);
        mOtherImage.put(key, R.id.other_11_9);
        key = R.id.cell_11_10;
        mIndexMap.put(key, 160);
        mChessImage.put(key, R.id.chess_11_10);
        mFocusImage.put(key, R.id.focus_11_10);
        mOtherImage.put(key, R.id.other_11_10);
        key = R.id.cell_11_11;
        mIndexMap.put(key, 161);
        mChessImage.put(key, R.id.chess_11_11);
        mFocusImage.put(key, R.id.focus_11_11);
        mOtherImage.put(key, R.id.other_11_11);
        key = R.id.cell_11_12;
        mIndexMap.put(key, 162);
        mChessImage.put(key, R.id.chess_11_12);
        mFocusImage.put(key, R.id.focus_11_12);
        mOtherImage.put(key, R.id.other_11_12);
        key = R.id.cell_11_13;
        mIndexMap.put(key, 163);
        mChessImage.put(key, R.id.chess_11_13);
        mFocusImage.put(key, R.id.focus_11_13);
        mOtherImage.put(key, R.id.other_11_13);
        key = R.id.cell_11_14;
        mIndexMap.put(key, 164);
        mChessImage.put(key, R.id.chess_11_14);
        mFocusImage.put(key, R.id.focus_11_14);
        mOtherImage.put(key, R.id.other_11_14);
        key = R.id.cell_11_15;
        mIndexMap.put(key, 165);
        mChessImage.put(key, R.id.chess_11_15);
        mFocusImage.put(key, R.id.focus_11_15);
        mOtherImage.put(key, R.id.other_11_15);

        key = R.id.cell_12_1;
        mIndexMap.put(key, 166);
        mChessImage.put(key, R.id.chess_12_1);
        mFocusImage.put(key, R.id.focus_12_1);
        mOtherImage.put(key, R.id.other_12_1);
        key = R.id.cell_12_2;
        mIndexMap.put(key, 167);
        mChessImage.put(key, R.id.chess_12_2);
        mFocusImage.put(key, R.id.focus_12_2);
        mOtherImage.put(key, R.id.other_12_2);
        key = R.id.cell_12_3;
        mIndexMap.put(key, 168);
        mChessImage.put(key, R.id.chess_12_3);
        mFocusImage.put(key, R.id.focus_12_3);
        mOtherImage.put(key, R.id.other_12_3);
        key = R.id.cell_12_4;
        mIndexMap.put(key, 169);
        mChessImage.put(key, R.id.chess_12_4);
        mFocusImage.put(key, R.id.focus_12_4);
        mOtherImage.put(key, R.id.other_12_4);
        key = R.id.cell_12_5;
        mIndexMap.put(key, 170);
        mChessImage.put(key, R.id.chess_12_5);
        mFocusImage.put(key, R.id.focus_12_5);
        mOtherImage.put(key, R.id.other_12_5);
        key = R.id.cell_12_6;
        mIndexMap.put(key, 171);
        mChessImage.put(key, R.id.chess_12_6);
        mFocusImage.put(key, R.id.focus_12_6);
        mOtherImage.put(key, R.id.other_12_6);
        key = R.id.cell_12_7;
        mIndexMap.put(key, 172);
        mChessImage.put(key, R.id.chess_12_7);
        mFocusImage.put(key, R.id.focus_12_7);
        mOtherImage.put(key, R.id.other_12_7);
        key = R.id.cell_12_8;
        mIndexMap.put(key, 173);
        mChessImage.put(key, R.id.chess_12_8);
        mFocusImage.put(key, R.id.focus_12_8);
        mOtherImage.put(key, R.id.other_12_8);
        key = R.id.cell_12_9;
        mIndexMap.put(key, 174);
        mChessImage.put(key, R.id.chess_12_9);
        mFocusImage.put(key, R.id.focus_12_9);
        mOtherImage.put(key, R.id.other_12_9);
        key = R.id.cell_12_10;
        mIndexMap.put(key, 175);
        mChessImage.put(key, R.id.chess_12_10);
        mFocusImage.put(key, R.id.focus_12_10);
        mOtherImage.put(key, R.id.other_12_10);
        key = R.id.cell_12_11;
        mIndexMap.put(key, 176);
        mChessImage.put(key, R.id.chess_12_11);
        mFocusImage.put(key, R.id.focus_12_11);
        mOtherImage.put(key, R.id.other_12_11);
        key = R.id.cell_12_12;
        mIndexMap.put(key, 177);
        mChessImage.put(key, R.id.chess_12_12);
        mFocusImage.put(key, R.id.focus_12_12);
        mOtherImage.put(key, R.id.other_12_12);
        key = R.id.cell_12_13;
        mIndexMap.put(key, 178);
        mChessImage.put(key, R.id.chess_12_13);
        mFocusImage.put(key, R.id.focus_12_13);
        mOtherImage.put(key, R.id.other_12_13);
        key = R.id.cell_12_14;
        mIndexMap.put(key, 179);
        mChessImage.put(key, R.id.chess_12_14);
        mFocusImage.put(key, R.id.focus_12_14);
        mOtherImage.put(key, R.id.other_12_14);
        key = R.id.cell_12_15;
        mIndexMap.put(key, 180);
        mChessImage.put(key, R.id.chess_12_15);
        mFocusImage.put(key, R.id.focus_12_15);
        mOtherImage.put(key, R.id.other_12_15);

        key = R.id.cell_13_1;
        mIndexMap.put(key, 181);
        mChessImage.put(key, R.id.chess_13_1);
        mFocusImage.put(key, R.id.focus_13_1);
        mOtherImage.put(key, R.id.other_13_1);
        key = R.id.cell_13_2;
        mIndexMap.put(key, 182);
        mChessImage.put(key, R.id.chess_13_2);
        mFocusImage.put(key, R.id.focus_13_2);
        mOtherImage.put(key, R.id.other_13_2);
        key = R.id.cell_13_3;
        mIndexMap.put(key, 183);
        mChessImage.put(key, R.id.chess_13_3);
        mFocusImage.put(key, R.id.focus_13_3);
        mOtherImage.put(key, R.id.other_13_3);
        key = R.id.cell_13_4;
        mIndexMap.put(key, 184);
        mChessImage.put(key, R.id.chess_13_4);
        mFocusImage.put(key, R.id.focus_13_4);
        mOtherImage.put(key, R.id.other_13_4);
        key = R.id.cell_13_5;
        mIndexMap.put(key, 185);
        mChessImage.put(key, R.id.chess_13_5);
        mFocusImage.put(key, R.id.focus_13_5);
        mOtherImage.put(key, R.id.other_13_5);
        key = R.id.cell_13_6;
        mIndexMap.put(key, 186);
        mChessImage.put(key, R.id.chess_13_6);
        mFocusImage.put(key, R.id.focus_13_6);
        mOtherImage.put(key, R.id.other_13_6);
        key = R.id.cell_13_7;
        mIndexMap.put(key, 187);
        mChessImage.put(key, R.id.chess_13_7);
        mFocusImage.put(key, R.id.focus_13_7);
        mOtherImage.put(key, R.id.other_13_7);
        key = R.id.cell_13_8;
        mIndexMap.put(key, 188);
        mChessImage.put(key, R.id.chess_13_8);
        mFocusImage.put(key, R.id.focus_13_8);
        mOtherImage.put(key, R.id.other_13_8);
        key = R.id.cell_13_9;
        mIndexMap.put(key, 189);
        mChessImage.put(key, R.id.chess_13_9);
        mFocusImage.put(key, R.id.focus_13_9);
        mOtherImage.put(key, R.id.other_13_9);
        key = R.id.cell_13_10;
        mIndexMap.put(key, 190);
        mChessImage.put(key, R.id.chess_13_10);
        mFocusImage.put(key, R.id.focus_13_10);
        mOtherImage.put(key, R.id.other_13_10);
        key = R.id.cell_13_11;
        mIndexMap.put(key, 191);
        mChessImage.put(key, R.id.chess_13_11);
        mFocusImage.put(key, R.id.focus_13_11);
        mOtherImage.put(key, R.id.other_13_11);
        key = R.id.cell_13_12;
        mIndexMap.put(key, 192);
        mChessImage.put(key, R.id.chess_13_12);
        mFocusImage.put(key, R.id.focus_13_12);
        mOtherImage.put(key, R.id.other_13_12);
        key = R.id.cell_13_13;
        mIndexMap.put(key, 193);
        mChessImage.put(key, R.id.chess_13_13);
        mFocusImage.put(key, R.id.focus_13_13);
        mOtherImage.put(key, R.id.other_13_13);
        key = R.id.cell_13_14;
        mIndexMap.put(key, 194);
        mChessImage.put(key, R.id.chess_13_14);
        mFocusImage.put(key, R.id.focus_13_14);
        mOtherImage.put(key, R.id.other_13_14);
        key = R.id.cell_13_15;
        mIndexMap.put(key, 195);
        mChessImage.put(key, R.id.chess_13_15);
        mFocusImage.put(key, R.id.focus_13_15);
        mOtherImage.put(key, R.id.other_13_15);

        key = R.id.cell_14_1;
        mIndexMap.put(key, 196);
        mChessImage.put(key, R.id.chess_14_1);
        mFocusImage.put(key, R.id.focus_14_1);
        mOtherImage.put(key, R.id.other_14_1);
        key = R.id.cell_14_2;
        mIndexMap.put(key, 197);
        mChessImage.put(key, R.id.chess_14_2);
        mFocusImage.put(key, R.id.focus_14_2);
        mOtherImage.put(key, R.id.other_14_2);
        key = R.id.cell_14_3;
        mIndexMap.put(key, 198);
        mChessImage.put(key, R.id.chess_14_3);
        mFocusImage.put(key, R.id.focus_14_3);
        mOtherImage.put(key, R.id.other_14_3);
        key = R.id.cell_14_4;
        mIndexMap.put(key, 199);
        mChessImage.put(key, R.id.chess_14_4);
        mFocusImage.put(key, R.id.focus_14_4);
        mOtherImage.put(key, R.id.other_14_4);
        key = R.id.cell_14_5;
        mIndexMap.put(key, 200);
        mChessImage.put(key, R.id.chess_14_5);
        mFocusImage.put(key, R.id.focus_14_5);
        mOtherImage.put(key, R.id.other_14_5);
        key = R.id.cell_14_6;
        mIndexMap.put(key, 201);
        mChessImage.put(key, R.id.chess_14_6);
        mFocusImage.put(key, R.id.focus_14_6);
        mOtherImage.put(key, R.id.other_14_6);
        key = R.id.cell_14_7;
        mIndexMap.put(key, 202);
        mChessImage.put(key, R.id.chess_14_7);
        mFocusImage.put(key, R.id.focus_14_7);
        mOtherImage.put(key, R.id.other_14_7);
        key = R.id.cell_14_8;
        mIndexMap.put(key, 203);
        mChessImage.put(key, R.id.chess_14_8);
        mFocusImage.put(key, R.id.focus_14_8);
        mOtherImage.put(key, R.id.other_14_8);
        key = R.id.cell_14_9;
        mIndexMap.put(key, 204);
        mChessImage.put(key, R.id.chess_14_9);
        mFocusImage.put(key, R.id.focus_14_9);
        mOtherImage.put(key, R.id.other_14_9);
        key = R.id.cell_14_10;
        mIndexMap.put(key, 205);
        mChessImage.put(key, R.id.chess_14_10);
        mFocusImage.put(key, R.id.focus_14_10);
        mOtherImage.put(key, R.id.other_14_10);
        key = R.id.cell_14_11;
        mIndexMap.put(key, 206);
        mChessImage.put(key, R.id.chess_14_11);
        mFocusImage.put(key, R.id.focus_14_11);
        mOtherImage.put(key, R.id.other_14_11);
        key = R.id.cell_14_12;
        mIndexMap.put(key, 207);
        mChessImage.put(key, R.id.chess_14_12);
        mFocusImage.put(key, R.id.focus_14_12);
        mOtherImage.put(key, R.id.other_14_12);
        key = R.id.cell_14_13;
        mIndexMap.put(key, 208);
        mChessImage.put(key, R.id.chess_14_13);
        mFocusImage.put(key, R.id.focus_14_13);
        mOtherImage.put(key, R.id.other_14_13);
        key = R.id.cell_14_14;
        mIndexMap.put(key, 209);
        mChessImage.put(key, R.id.chess_14_14);
        mFocusImage.put(key, R.id.focus_14_14);
        mOtherImage.put(key, R.id.other_14_14);
        key = R.id.cell_14_15;
        mIndexMap.put(key, 210);
        mChessImage.put(key, R.id.chess_14_15);
        mFocusImage.put(key, R.id.focus_14_15);
        mOtherImage.put(key, R.id.other_14_15);

        key = R.id.cell_15_1;
        mIndexMap.put(key, 211);
        mChessImage.put(key, R.id.chess_15_1);
        mFocusImage.put(key, R.id.focus_15_1);
        mOtherImage.put(key, R.id.other_15_1);
        key = R.id.cell_15_2;
        mIndexMap.put(key, 212);
        mChessImage.put(key, R.id.chess_15_2);
        mFocusImage.put(key, R.id.focus_15_2);
        mOtherImage.put(key, R.id.other_15_2);
        key = R.id.cell_15_3;
        mIndexMap.put(key, 213);
        mChessImage.put(key, R.id.chess_15_3);
        mFocusImage.put(key, R.id.focus_15_3);
        mOtherImage.put(key, R.id.other_15_3);
        key = R.id.cell_15_4;
        mIndexMap.put(key, 214);
        mChessImage.put(key, R.id.chess_15_4);
        mFocusImage.put(key, R.id.focus_15_4);
        mOtherImage.put(key, R.id.other_15_4);
        key = R.id.cell_15_5;
        mIndexMap.put(key, 215);
        mChessImage.put(key, R.id.chess_15_5);
        mFocusImage.put(key, R.id.focus_15_5);
        mOtherImage.put(key, R.id.other_15_5);
        key = R.id.cell_15_6;
        mIndexMap.put(key, 216);
        mChessImage.put(key, R.id.chess_15_6);
        mFocusImage.put(key, R.id.focus_15_6);
        mOtherImage.put(key, R.id.other_15_6);
        key = R.id.cell_15_7;
        mIndexMap.put(key, 217);
        mChessImage.put(key, R.id.chess_15_7);
        mFocusImage.put(key, R.id.focus_15_7);
        mOtherImage.put(key, R.id.other_15_7);
        key = R.id.cell_15_8;
        mIndexMap.put(key, 218);
        mChessImage.put(key, R.id.chess_15_8);
        mFocusImage.put(key, R.id.focus_15_8);
        mOtherImage.put(key, R.id.other_15_8);
        key = R.id.cell_15_9;
        mIndexMap.put(key, 219);
        mChessImage.put(key, R.id.chess_15_9);
        mFocusImage.put(key, R.id.focus_15_9);
        mOtherImage.put(key, R.id.other_15_9);
        key = R.id.cell_15_10;
        mIndexMap.put(key, 220);
        mChessImage.put(key, R.id.chess_15_10);
        mFocusImage.put(key, R.id.focus_15_10);
        mOtherImage.put(key, R.id.other_15_10);
        key = R.id.cell_15_11;
        mIndexMap.put(key, 221);
        mChessImage.put(key, R.id.chess_15_11);
        mFocusImage.put(key, R.id.focus_15_11);
        mOtherImage.put(key, R.id.other_15_11);
        key = R.id.cell_15_12;
        mIndexMap.put(key, 222);
        mChessImage.put(key, R.id.chess_15_12);
        mFocusImage.put(key, R.id.focus_15_12);
        mOtherImage.put(key, R.id.other_15_12);
        key = R.id.cell_15_13;
        mIndexMap.put(key, 223);
        mChessImage.put(key, R.id.chess_15_13);
        mFocusImage.put(key, R.id.focus_15_13);
        mOtherImage.put(key, R.id.other_15_13);
        key = R.id.cell_15_14;
        mIndexMap.put(key, 224);
        mChessImage.put(key, R.id.chess_15_14);
        mFocusImage.put(key, R.id.focus_15_14);
        mOtherImage.put(key, R.id.other_15_14);
        key = R.id.cell_15_15;
        mIndexMap.put(key, 225);
        mChessImage.put(key, R.id.chess_15_15);
        mFocusImage.put(key, R.id.focus_15_15);
        mOtherImage.put(key, R.id.other_15_15);
    }
}